<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simSendModuleMessage</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simSendModuleMessage" id="simSendModuleMessage"></a>simSendModuleMessage</h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Sends a message to plugins. This function should normally only be used from the <a href="../mainClientApplication.htm">main client application</a> side. See also <a href="simLoadModule.htm">sim.loadModule</a> and <a href="simBroadcastMessage.htm">simBroadcastMessage</a>.
</td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simVoid* simSendModuleMessage(simInt message,simInt* auxiliaryData,simVoid* customData,simInt* replyData)</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>message</strong>: the message to send. Refer to <a href="../apiConstants.htm#simulatorMessages">sim_message_eventcallback_</a>-type messages.<br>
</div>
<div><strong>auxiliaryData</strong>: pointer to 4 integers. auxiliaryData[0] should be a unique identifier different from 0. Use a large random identifier, or better, your CoppeliaSim serial number if the message is yours. Otherwise, use the identifier of some other module. auxiliaryData[1] could be the messageID of the message you wish to send to another module. auxiliaryData[2] and auxiliaryData[3] can be any values specific to your application.<br>
</div>
<div><strong>customData</strong>: customData of your application (the broadcaster is in charge to release that buffer). Can be nullptr.<br>
</div>
<div><strong>replyData</strong>: pointer to 4 integers that can be used by a module to reply to a broadcasted message. Can be nullptr. If not nullptr, all 4 values are automatically initialized to -1.<br>
</div>
<br>
<div>Broadcasted messages can be intercepted in a plugin's "simMessage"-function.</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>Pointer to custom reply data that can be used by a module to reply to a broadcasted message. The module that replies is in charge of allocating the data with <a href="simCreateBuffer.htm">simCreateBuffer</a> and the original broadcaster is in charge of releasing that data with <a href="simReleaseBuffer.htm">simReleaseBuffer</a>. A reply to a broadcasted message is triggered by a module that writes a value different from -1 into auxiliaryData[0]-auxiliaryData[3], thus aborting further broadcast of the original message and returning to the broadcaster. If the return value is different from nullptr, the broadcast is also interrupted.<br>
</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn><div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div></div></td> 
</tr> 
</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
